<style lang="scss" scoped>
.systemBox {
  padding: 10px;

  .texts {
    margin-bottom: 10px;
    padding: 10px;
    margin-top: 10px;
    width: 100%;
    border: 1px solid #efefef;

    span {
      font-size: 16px;
    }
  }
}
</style>
<template>
  <div class="systemBox">
    <van-nav-bar title="系统消息" left-arrow @click-left="$router.push('/information')" />
    <div class="texts" v-for="(item, index) in systemMsg" :key="index">
      <span>{{ item.content }}</span>
    </div>
  </div>
</template>

<script setup lang="ts">
import { useRouter } from 'vue-router'
import { request } from '../../axios/request'
import { ref } from 'vue'

// 获取userId, sessionId
const userId = JSON.parse(localStorage.getItem('userId') || '0') // 示例用户 IDzzz
const sessionId = JSON.parse(localStorage.getItem('sessionId') || '0') // 示例会话 ID

// 系统消息
const systemMsg: any = ref([])

const getsystem = async () => {
  await request
    .get('/api/health/user/verify/v1/findSystemNoticeList', {
      params: {
        page: 1,
        count: 10
      },
      headers: {
        userId: userId.value,
        sessionId: sessionId.value
      }
    })
    .then((res) => {
      systemMsg.value = res.data.result
      console.log(systemMsg.value, '系统消息')
    })
}
getsystem()
</script>
